package com.cy.springboot.initializer;

import javax.servlet.ServletContainerInitializer;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.annotation.HandlesTypes;
import java.util.Set;

/**
 * @Author ChenYan
 * @Date 2021/8/11 16:32
 * @Description
 */
@HandlesTypes({MyWebApplicationInitializer.class})
public class MySpringServletContainerInitializer implements ServletContainerInitializer {

    public void onStartup(Set<Class<?>> set, ServletContext servletContext) throws ServletException {
        System.out.println("根据 Servlet3.0规范，执行了MySpringServletContainerInitializer");

        //避免重复执行
//        new MyWebApplicationInitializer().onStartup(servletContext);
    }

}
